import java.util.HashSet;

/**
 * 数组中是否有重复数字
 */
public class Work1 {

    public static void main(String[] args) {
        int[] arr = new int[]{1,2,3};
        //int[] arr = new int[]{1,2,1};
        boolean res = query(arr);
        System.out.println("res = " + (res?"Yes":"No"));

    }

    public static boolean query(int[] arr){
        //利用hashset的add方法，相同的值添加会返回false
        HashSet<Integer> set = new HashSet<>();
        for (int i=0; i<arr.length;i++){
            if (!set.add(arr[i])){
                return false;
            }
        }
        return true;
    }
}
